<?php session_start(); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Violation</title>
<script type="text/javascript" src="validateInformation.js" ></script>


<?php
require_once 'UpdateManager.php';
if(isset($_POST['Done']))
{
	$snum=$_SESSION['snum'];
	$vdate=$_POST['appMonth'].$_POST['violationDate'].$_POST['appYear'];		
	$rdate=$_POST['appMonth'].$_POST['reportedDate'].$_POST['appYear'];	
	$nature=$_POST['violationNature'];
	$action=$_POST['remarksAppliance2'];

	
	$f = UpdateManager::updateViolation($snum,$vdate,$nature,$action,$rdate);
	if($f){
		UpdateManager::showMessage($f);
	}else{
		UpdateManager::showMessage(0);
	}
}

?>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>

<body>
<table width="100%" border="0" cellpadding="1">
 
  <tr>
    <td>&nbsp;</td>
    <td class="subBanner"><strong> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Add Resident Violation</strong></td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td><form id="form1" name="form1" method="post" action="" onsubmit="return validateInformation9(this)">
      <table width="100%" border="0" cellpadding="1">
        <tr>
          <td>&nbsp;</td>
          <td><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </strong>&nbsp;</td>
          <td id="lname2" class="error">&nbsp;</td>
        </tr>
        <tr>
		<?php
			$dd=substr($_SESSION['dateviolation'],0,2);			
			$mm=substr($_SESSION['dateviolation'],2,3);
			$yy=substr($_SESSION['dateviolation'],5,4);
		  ?>
		
          <td width="37%"><strong>Date of Violation</strong></td>
          <td width="34%"><strong>
            <select name="appMonth" id="bdMonth">
			  <option value="JAN" <?php if($mm=='JAN')echo "selected='selected'"?>>January</option>
              <option value="FEB" <?php if($mm=='FEB')echo "selected='selected'"?>>February</option>
              <option value="MAR" <?php if($mm=='MAR')echo "selected='selected'"?>>March</option>
              <option value="APR" <?php if($mm=='APR')echo "selected='selected'"?>>April</option>
              <option value="MAY" <?php if($mm=='MAY')echo "selected='selected'"?>>May</option>
              <option value="JUN" <?php if($mm=='JUN')echo "selected='selected'"?>>June</option>
              <option value="JUL" <?php if($mm=='JUL')echo "selected='selected'"?>>July</option>
              <option value="AUG" <?php if($mm=='AUG')echo "selected='selected'"?>>August</option>
              <option value="SEP" <?php if($mm=='SEP')echo "selected='selected'"?>>September</option>
              <option value="OCT" <?php if($mm=='OCT')echo "selected='selected'"?>>October</option>
              <option value="NOV" <?php if($mm=='NOV')echo "selected='selected'"?>>November</option>
              <option value="DEC" <?php if($mm=='DEC')echo "selected='selected'"?>>December</option>
            </select>
&nbsp;
<label for="bdDay"></label>
<label for="bdDate"></label>
<input name="violationDate" type="text" size="3" value="<?php echo $dd;?>"/>
&nbsp;
<label for="bdYear"></label>
<select name="appYear" >
<?php
$ys=1985;
$ye=2011;

for(;$ys <= $ye; $ys++)
{
	echo "<option value='1985'"; if($yy==$ys)echo "selected='selected'"; echo ">" . $ys . "</option>";
}
?>
</select>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;          </strong></td>
          <td width="29%" id="vdate" class="error">&nbsp;</td>
        </tr>
        <tr>
          <td>Nature</td>
          <td><strong>
            <textarea name="violationNature" cols="35" rows="4"><?php echo $_SESSION['nature']?></textarea>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;          </strong></td>
         <!-- <td id="gaddress" class="error">&nbsp;</td> -->
		 <td id="nature" class="error">&nbsp;</td>
        </tr>
        <tr>
          <td>Action Taken</td>
          <td><strong>
            <textarea name="remarksAppliance2" cols="35" rows="4"><?php echo $_SESSION['action']?></textarea>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;            </strong></td>
          <!-- <td id="gcp" class="error">&nbsp;</td> -->
		  <td id="action" class="error">&nbsp;</td> 
        </tr>
        <tr>
	     <?php
			$dd=substr($_SESSION['datereported'],0,2);			
			$mm=substr($_SESSION['datereported'],2,3);
			$yy=substr($_SESSION['datereported'],5,4);
		  ?>
          <td>Date reported</td>
          <td><strong>
            <select name="appMonth2" id="appMonth">
			  <option value="JAN" <?php if($mm=='JAN')echo "selected='selected'"?>>January</option>
              <option value="FEB" <?php if($mm=='FEB')echo "selected='selected'"?>>February</option>
              <option value="MAR" <?php if($mm=='MAR')echo "selected='selected'"?>>March</option>
              <option value="APR" <?php if($mm=='APR')echo "selected='selected'"?>>April</option>
              <option value="MAY" <?php if($mm=='MAY')echo "selected='selected'"?>>May</option>
              <option value="JUN" <?php if($mm=='JUN')echo "selected='selected'"?>>June</option>
              <option value="JUL" <?php if($mm=='JUL')echo "selected='selected'"?>>July</option>
              <option value="AUG" <?php if($mm=='AUG')echo "selected='selected'"?>>August</option>
              <option value="SEP" <?php if($mm=='SEP')echo "selected='selected'"?>>September</option>
              <option value="OCT" <?php if($mm=='OCT')echo "selected='selected'"?>>October</option>
              <option value="NOV" <?php if($mm=='NOV')echo "selected='selected'"?>>November</option>
              <option value="DEC" <?php if($mm=='DEC')echo "selected='selected'"?>>December</option>
            </select>
&nbsp;
<label for="bdDay2"></label>
<label for="bdDate"></label>
<input name="reportedDate" type="text" size="3" value="<?php echo $dd;?>"/>
&nbsp;
<label for="bdYear"></label>
<select name="appYear2" >
	<?php
		$ys=1985;
		$ye=2011;

		for(;$ys <= $ye; $ys++)
		{
			echo "<option value='1985'"; if($yy==$ys)echo "selected='selected'"; echo ">" . $ys . "</option>";
		}
	?>
</select>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</strong></td>
          <td id="rdate" class="error">&nbsp;</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td><input type="submit" name="Done" id="Done" value="Done" /></td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td></td>
          <td>&nbsp;</td>
        </tr>
        </table>
    </form></td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
</body>
</html>
